﻿<template>
    <div>
        <!-- 添加按钮 -->
        <div class="btn-add">

        </div>
        <!-- 按条件选择 -->
        <div class="padding20">
            <el-col :span="24">
                <el-form :inline="true" class="demo-form-inline" label-position="top">
                    <el-select v-model="formtype" filterable @change="getData()">
                        <el-option label="我创建的" value="1"></el-option>
                        <el-option label="待我处理的" value="2"></el-option>
                        <el-option label="我已处理的" value="3"></el-option>
                        <!--<el-option label="抄送我的" value="4"></el-option>-->
                    </el-select>
                    <el-date-picker v-model="sedate"
                                    type="daterange"
                                    align="right"
                                    value-format="yyyy-MM-dd"
                                    unlink-panels
                                    range-separator="至"
                                    start-placeholder="创建开始日期"
                                    end-placeholder="创建结束日期"
                                    :picker-options="pickerOptions">
                    </el-date-picker>
                    <el-button type="primary" @click="getData">查询</el-button>
                </el-form>

            </el-col>

        </div>
        <!-- 表格 -->
        <div class="default-tab ft14 padding20 hover-btn">

            <base-table :pzoption="tableop" @selection-change="handleSelectionChange">
            </base-table>

        </div>
        <!--<div>
            <el-pagination background @current-change="handleCurrentChange" :page-size="pagesize" :current-page="nowpage" layout="prev, pager, next" :total="datatotal" style="text-align:center;margin-top:8px"></el-pagination>
        </div>-->

    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue')
        },
        data: function () {
            return {
                formtype: "1",
                sedate: [ComFunJS.getnowdate("yyyy") + "-01-01", ComFunJS.getnowdate("yyyy-mm-dd")],
                datatotal: 0,
                pagesize: 200,
                nowpage: 1,
                pickerOptions: {
                    shortcuts: [{
                        text: '最近一周',
                        onClick: function (picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick: function (picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近三个月',
                        onClick: function (picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },
                tableop: {
                    title: "表单列表",
                    issel: true,
                    iscz: false,
                    isxh: true,

                    dataset: [],
                    dtcxdata: [{ cxname: "表单类型", cxzd: "ProcessName", cxdata: "", cal: "0", datatype: "1", dtsource: [], val: "" }],

                    multipleSelection: [],
                    czltabledata: [
                        {
                            colname: "处理表单", bttype: "text", isshow: true, mangefun: function (rowdata) {
                                top.ComFunJS.winviewform("/ViewV5/AppPage/FORMBI/FormManage.html?vtype=2&piid=" + rowdata.ID, '查看表单', "1000", "");

                            },
                        }
                    ],
                    collist: [
                        { colid: "BranchName", colname: "发起部门", isshow: true, istip: true },
                        { colid: "ProcessName", colname: "表单类型", isshow: true, istip: true },
                        { colid: "CRUser", colname: "创建用户代码", isshow: false, istip: true },
                        { colid: "CRDate", colname: "创建时间", isshow: true, istip: true },
                        { colid: "CRUserName", colname: "创建用户", isshow: true, istip: true },
                        { colid: "StatusName", colname: "表单状态", isshow: true, istip: true },


                    ]
                }
            }
        },
        methods: {
            handleSelectionChange(val) {
                this.tableop.multipleSelection = val;
            },
            getData: function () {
                var pro = this;
                $.getJSON('/api/Bll/ExeAction?Action=FORMBI_GETLCSPLIST', { p: 1, P1: pro.formtype, pagecount: 10000, sdate: pro.sedate[0], edate: pro.sedate[1]}, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        pro.tableop.dataset = resultData.Result;
                        pro.datatotal = resultData.Result1;
                    }

                })
            },
            handleCurrentChange: function (val) {
                var chi = this;
                chi.nowpage = val;
                chi.getData();
            },

        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.getData();
            })

        },
        watch: {

        }
    };
</script>